<template>
  <div id="app">
    <AutoComplete
     @select='getSelect'>
     <div class="customeDom">
       <ul>
         <li 
          @click="getValue(item)"
          v-for="(item, index) in list" 
          :key="index">{{item}}</li>
       </ul>
     </div>
    </AutoComplete>
     <p class="selected_value" v-show="selected">这是您选中的值：{{selected}}</p>
  </div>
</template>

<script>
import AutoComplete from '@/components/AutoComplete'
export default {
  name: 'app',
  components: {
    AutoComplete
  },
  data () {
    return {
      list: [],
      selected: ''
    }
  },
  methods: {
    getValue (value) {
      this.list = []
      this.selected = value
    },
    getSelect (select) {
      this.list.push(select)
    }
  }
}
</script>

<style>
#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
.selected_value {
  width: 100%;
  margin-top: 20px;
  padding-top: 10px;
}
li {
  list-style: none;
  cursor: pointer;
}
</style>
